#include "alternatedconstraint.h"

AlternatedConstraint::AlternatedConstraint(
    boost::shared_ptr<Constraint> lconstraint,
    boost::shared_ptr<Constraint> rconstraint)
	: lconstraint_(lconstraint),
	  rconstraint_(rconstraint)
{
}

AlternatedConstraint::~AlternatedConstraint()
{
}

/// Tests a schedule object to see if it fulfills any of the two alternative
/// constraints.
/// \param schedule The schedule object against which the constraint is tested.
/// \return True if the schedule fulfills the constraint, false otherwise.
bool AlternatedConstraint::consider(const Schedule& schedule)
{
	return lconstraint_->consider(schedule) || rconstraint_->consider(schedule);
}

std::string AlternatedConstraint::to_string()
{
    return lconstraint_->to_string() + " OR " + rconstraint_->to_string();
}
